package org.example.application.service.impl;

import org.example.application.assembler.OrderAssembler;
import org.example.application.dto.OrderDTO;
import org.example.domain.entity.Order;
import org.example.domain.repository.OrderRepository;
import org.example.infrastructure.repository.OrderRepositoryImpl;
import org.example.application.service.OrderService;

public class OrderServiceImpl implements OrderService {
    private OrderRepository orderRepository;
    private OrderAssembler orderAssembler;

    public OrderServiceImpl() {
        this.orderRepository = new OrderRepositoryImpl();
        this.orderAssembler = OrderAssembler.INSTANCE;
    }

    @Override
    public OrderDTO queryOrder(String orderId) {
        Order order = orderRepository.getOrder(orderId);
        return orderAssembler.fromEntity(order);
    }
}
